<table border="0" align="center" cellpadding="0" cellspacing="1" class="navi">
  <tr>
    <th>当前位置：客户账号管理</th>
  </tr>
</table>
<script type="text/javascript">
var base = <?=json_encode(SystemProperties::$app_host)?>;
function guestAdd(){
	var user = document.getElementById('username').value;
	var userpass = document.getElementById('userpass').value;
	window.location.href = base+"/user/guestAdd/"+user+'/'+userpass;
}

function guestAddProduct(guid){
	var addpid = document.getElementById('addpid_'+guid).value;
	window.location.href = base+"/user/guestAddProduct/"+guid+'/'+addpid;
}
function guestDeleteProduct(guid,pid){
	window.location.href = base+"/user/guestDeleteProduct/"+guid+'/'+pid;
}
function guestChangePassword(guid){
	var userpass = document.getElementById('editpass_'+guid).value;
	window.location.href = base+"/user/guestChangePassword/"+guid+'/'+userpass;
}
function guestDelete($guid){
}

</script>
<table border="0" align="center" cellpadding="0" cellspacing="1" class="list">
<tr>
<td>
<div style="padding:10px">
<strong>增加新客户账号</strong><br />
用户名：<input type="text" name="username" id="username"> &nbsp;&nbsp;&nbsp;密码（请不要包含/等特殊字符）： <input type="password" name="userpass" id="userpass"> &nbsp;&nbsp;&nbsp;<input onclick="guestAdd()" class="comment_btn_Submit"  type="button"  value="增加" />

<br /><br /><br />
<strong>管理客户账号</strong> <br /><br />
<?php foreach ($guestdata as $guest) { 
	$da = $guest['g_logins'];
	$pids = explode(',',$da['guest_pids']);
	
	?>
	<br /><br />
	<table cellpadding="0" cellspacing="0">
	<tr>
	<td>用户名：</td><td> <strong><?=$da['g_name'] ?></strong></td>
	</tr>
	<tr>
	<td>当前关联可查看产品：</td>
	<td>
	<?php 
	
	if (!empty($pids)){
		$i=0;
		foreach ($pids as $p){
			if (empty($p)){
				continue;
			}
			$i++;
			$pinfo = $Product->selectProduct($p);
			?>
			<strong><?=$p?></strong>（<?=$pinfo[0]['g_products']['g_name']?>）<a href="javascript:guestDeleteProduct('<?=$da['g_name'] ?>',<?=$p?>)"> [删除]</a><br />
			<?php 
		}
	}
	?>
	</tr>
	<tr>
	<td>增加产品（ID）：</td><td><input type="text" name="addpid" id="addpid_<?=$da['g_name'] ?>"><input onclick="guestAddProduct('<?=$da['g_name'] ?>')" type="button" class="comment_btn_Submit" value="增加关联产品" /></td>
	</tr>
	<tr>
	<td>修改密码：</td><td><input type="password" name="editpass" id="editpass_<?=$da['g_name'] ?>"><input onclick="guestChangePassword('<?=$da['g_name'] ?>')" type="button"  class="comment_btn_Submit" value="修改" /></td>
	</tr>
	</table>
	
	
<?php } ?>

</div>
</td>
</tr>
</table>


